package nccloud.web.gl.voucher.action;

import nc.vo.pub.BusinessException;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.container.IRequest;
import nccloud.web.codeplatform.framework.action.base.BaseAction;
import nccloud.web.codeplatform.framework.action.base.RequstParamWapper;
import nc.bs.voucher.itf.IVourcherSumService;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>预算执行监控联查凭证维护获取单据类型、单据ID</p>
 * @author wangyong
 * @Date 2025年10月16日
 *
 */
public class QueryBillLinkVoucherInfoAction extends BaseAction {

    @Override
    public Object doAction(IRequest iRequest, RequstParamWapper requstParamWapper) throws Throwable {
        try {
            String voucherNo = (String) requstParamWapper.get("code");
            String billDate = (String) requstParamWapper.get("billdate");
            String pk_group = (String) requstParamWapper.get("pk_group");
            String pk_org = (String) requstParamWapper.get("pk_org");
            IVourcherSumService service = ServiceLocator.find(IVourcherSumService.class);
            Map<String, Object> requestParam = new HashMap<>();
            requestParam.put("billcode",voucherNo);
            requestParam.put("billdate",billDate);
            requestParam.put("pk_group",pk_group);
            requestParam.put("pk_org",pk_org);
            Map map = service.queryVoucherInfo(requestParam);
            return  map;
        } catch (Exception e) {
            throw new BusinessException("预算执行监控联查凭证维护信息,异常:" + e.getMessage());
        }
    }
}
